package com.xjoyt.pay.merchant.register.po;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 商户费率
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_merchant_rate")
public class MerchantRate {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "merchant_rate_id", length = 36)
	public String id;

	/**
	 * 状态(null:未审核,true:审核通过,false:审核不通过)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "is_enabled")
	public Boolean enabled;

	/**
	 * 商户
	 */
	@ManyToOne(targetEntity = Merchant.class, cascade = {})
	@JoinColumn(name = "merchant_id", foreignKey = @ForeignKey(name = "none"))
	// @JsonIgnore
	public Merchant merchant;

	/**
	 * 费率集合
	 */
	@OneToMany(targetEntity = MerchantRateDetail.class, cascade = { CascadeType.REMOVE })
	@JoinColumn(name = "merchant_rate_id", foreignKey = @ForeignKey(name = "none"))
	// @JsonIgnore
	public List<MerchantRateDetail> rateList;
}
